var mongoose = require('mongoose')

//连接数据库
mongoose.connect('mongodb://localhost/test')


var Schema = mongoose.Schema

//设置模型
var userSchema = new Schema({
    email: {
        type: String,
        required: true
    },
    nickname: {
        type: String,
        required: true
    },
    password: {
        type: Number,
        required: true
    },
    create_Date: {
        type: Date,
        default: Date.now
    },
    avatar: {
        type: String,
        default: '/public/img/avatar-max-img.png'
    },
    bio: {
        type: String,
        default: ''
    },
    gender: {
        type: Number,
        enum: [-1, 0, 1],
        default: -1
    },
    birthday: {
        type: Date,
        enum: [-1, 0, 1],
        default: -1
    },
    status: {
        //0 没有权限设置
        // 1 不可以登陆
        // 2 不可以评论
        type: Number,
        enum: [0, 1, 2],
        default: 0
    }
})


module.exports = mongoose.model('User', userSchema)